package com.bytedance.improvingroad.activity

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.recyclerview.widget.ItemTouchHelper
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.bytedance.improvingroad.R
import com.bytedance.improvingroad.adapter.SlideCardAdapter
import com.bytedance.improvingroad.model.SlideCardBean
import com.bytedance.improvingroad.utils.SlideCallback
import com.bytedance.improvingroad.utils.Utils
import com.bytedance.improvingroad.widget.SlideCardLayoutManager

class SlideCardActivity : BaseActivity() {
    private lateinit var mSlideCardRecycler: RecyclerView
    private lateinit var adapter: SlideCardAdapter
    private lateinit var mDatas: MutableList<SlideCardBean>
    override fun init() {
        mSlideCardRecycler = findViewById(R.id.slide_card_recycler)
        mSlideCardRecycler.layoutManager = SlideCardLayoutManager()
        mDatas = Utils.getSlideBeanArr()
        adapter = SlideCardAdapter(mDatas)
        mSlideCardRecycler.adapter = adapter
        ItemTouchHelper(SlideCallback(adapter,mDatas)).attachToRecyclerView(mSlideCardRecycler)
    }

    override fun getLayoutId() = R.layout.activity_slide_card

}